From: Stefano Stabellini Date: Fri, 21 Nov 2014 14:31:30 +0000 (+0000) Subject: xen/arm: clear UIE on hypervisor entry X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~4063 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=31180f87e4f7f63e3bca029b4a60978f57eb0331;p=xen.git xen/arm: clear UIE on hypervisor entry UIE being set can cause maintenance interrupts to occur when Xen writes to one or more LR registers. The effect is a busy loop around the interrupt handler in Xen (http://marc.info/?l=xen-devel&m=141597517132682): everything gets stuck. Signed-off-by: Stefano Stabellini Acked-by: Ian Campbell Reported-and-Tested-by: Andrii Tseglytskyi Tested-by: Julien Grall Release-acked-by: Konrad Rzeszutek Wilk --- diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 70d10d68a9..e7a1af5c1b 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -403,6 +403,8 @@ void gic_clear_lrs(struct vcpu *v) if ( is_idle_vcpu(v) ) return; + gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 0); + spin_lock_irqsave(&v->arch.vgic.lock, flags); while ((i = find_next_bit((const unsigned long *) &this_cpu(lr_mask), @@ -527,8 +529,6 @@ void gic_inject(void) if ( !list_empty(¤t->arch.vgic.lr_pending) && lr_all_full() ) gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 1); - else - gic_hw_ops->update_hcr_status(GICH_HCR_UIE, 0); } static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi) @@ -598,6 +598,11 @@ static void maintenance_interrupt(int irq, void *dev_id, struct cpu_user_regs *r * Receiving the interrupt is going to cause gic_inject to be called * on return to guest that is going to clear the old LRs and inject * new interrupts. + * + * Do not add code here: maintenance interrupts caused by setting + * GICH_HCR_UIE, might read as spurious interrupts (1023) because + * GICH_HCR_UIE is cleared before reading GICC_IAR. As a consequence + * this handler is not called. */ }